package com.fenghongzhang.kuaishou.index.home;

import android.content.Context;
import android.util.Log;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

import com.fenghongzhang.kuaishou.R;
import com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer;

/**
 * 自定义布局,在这里面加入PagerSnapHelper,
 * 他可以帮助recycleView实现整页翻页的效果.
 *
 */
public class MyLayoutManager extends LinearLayoutManager implements RecyclerView.OnChildAttachStateChangeListener {

    private static final String TAG = "MyLayoutManager";
    private PagerSnapHelper pagerSnapHelper;

    public MyLayoutManager(Context context) {
        super(context);
    }

    @Override
    public void onAttachedToWindow(RecyclerView view) {
        super.onAttachedToWindow(view);
        pagerSnapHelper = new PagerSnapHelper();
        pagerSnapHelper.attachToRecyclerView(view);
        view.addOnChildAttachStateChangeListener(this);
    }

    /**
     * 建立链接
     */
    @Override
    public void onChildViewAttachedToWindow(@NonNull View view) {

    }

    /**
     * 断开链接
     *
     * @param view
     */
    @Override
    public void onChildViewDetachedFromWindow(@NonNull View view) {

    }


}
